package com.woniuxy.enums.user;

import lombok.Getter;

/**
 * 社交关系类型枚举
 *
 * @author 饶志
 * @version 1.0
 * @since 2025-07-12  13:29
 */
@Getter
public enum SocialRelationshipType {

    FOLLOW(1, "关注"),
    MUTUAL(2, "互相关注");

    private final Integer type;
    private final String description;

    SocialRelationshipType(Integer type, String description) {
        this.type = type;
        this.description = description;
    }

    /**
     * 根据类型值获取对应的枚举
     *
     * @param type 类型码
     * @return 对应的枚举对象
     */
    public static SocialRelationshipType fromType(Integer type) {
        for (SocialRelationshipType s : values()) {
            if (s.getType().equals(type)) {
                return s;
            }
        }
        throw new IllegalArgumentException("Invalid type: " + type);
    }
}
